package indi.gtl.superbrain.adapter;

import java.util.List;

import indi.gtl.superbrain.R;
import indi.gtl.superbrain.models.UserInfo;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class GameTryAdapter extends BaseAdapter{

	Context context;
	List<UserInfo>list;
	public GameTryAdapter(List<UserInfo>list,Context context) {
		this.context=context;
		this.list=list;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		arg1=LayoutInflater.from(context).inflate(R.layout.game_try_layout, null);
		ImageView imageView=(ImageView) arg1.findViewById(R.id.main_third_gameimage);
		TextView textView=(TextView) arg1.findViewById(R.id.main_third_gamename);
		
		UserInfo info=list.get(arg0);
		imageView.setImageResource(info.head);
		textView.setText(info.name);
		return arg1;
	}

}
